<html>
<meta http-equiv="Content-Type"content="text/http;charset=utf-8;"/>
<style>
#table1
{
background: -webkit-linear-gradient(#9900FF,#0000CC);
color: white;
}
.label_txt1
{
background-color:#00BFFF;
color: white;
}
.label_txt2
{
background-color:#828282;
color: white;
}
#btn_hien
{
background: -webkit-linear-gradient(#696969,#9C9C9C);
border: 0px;
color:white;
-webkit-box-shadow: 0 2px 4px 1px #663309;
-webkit-border-radius:4px;
}
#btn_hien:hover
{
background: -webkit-linear-gradient(#B5B5B5,#E8E8E8);
}
#btn_hien:active
{
position:relative;
top: 1px;
left:1px;
}
#result
{
width: 226px;
}
</style>

<body>
<?php
function find_UCLN($a,$b)
{
	$min = 0;
	$UCNL = 0;
	if($a >= $b)
	{	
		$min = $b;
	}
	else
		$min = $a;
	for($i = 1; $i <= $min; $i++)
	{
		if($a % $i == 0 && $b % $i == 0)
		{
			$UCNL = $i;
		}
	}	
	return $UCNL;
}
function find_BCNN($a,$b)
{
	$max = 0;
	if($a >= $b)
	{
		$max = $a;
	}
	else
	{
		$max = $b;
	}
	for($i = $max ; $i <= $a * $b; $i++)
	{
		if($i % $a == 0 && $i % $b == 0)
		{
			return $i;
		}
	}
	
}		
if(isset($_POST["a"]) && isset($_POST["a"]))
{
	$a = $_POST["a"];
	$b = $_POST["b"];
	$UCLN = find_UCLN($a, $b);
	$BCNN = find_BCNN($a, $b);
}
?>
<form id="form1"name="form1"method="post"action="UCLN_BCNN.php">
<table id="table1"align="center"border="1px">
<tr>
	<td colspan="2"align="center">TÌM ƯỚC CHUNG LỚN NHẤT VÀ <br>BỘI CHUNG NHỎ NHẤT</td>
</tr>
<tr>
	<td>Nhập a: </td>
	<td><label><input class="label_txt1"name="a"id="a"type="text"value="<?php
	if(isset($_POST["a"]))
	{
		echo $_POST["a"];
	}
	?>"/></label></td>
</tr>
<tr>
	<td>Nhập b: </td>
	<td><label><input class="label_txt1"name="b"id="b"type="text"value="<?php
	if(isset($_POST["b"]))
	{
		echo $_POST["b"];
	}
	?>"/></label></td>
</tr>
<tr>
	<td>uscln: </td>
	<td><label><input readonly="true"class="label_txt2"name="UCLN"id="UCLN"type="text"value="<?php
	if(isset($_POST["UCLN"]))
	{
		echo $UCLN;
	}
	?>"/></label></td>
</tr>
<tr>
	<td>bscnn: </td>
	<td><label><input readonly="true"class="label_txt2"name="BCNN"id="BCNN"type="text"value="<?php
	if(isset($_POST["BCNN"]))
	{
		echo $BCNN;
	}
	?>"/></label></td>
</tr>
<tr>
	<td colspan="2"align="center"><label><input id="btn_hien"type="submit"value="hiện số nguyên tố <= n"/></label></td>
</tr>
</table> 	


</form>
</body>

<html>